{% extends 'teachers/base.html' %}
{% block teachers_index %}
    {% load static %}
    <div class="">
        <h3 style="margin-top: 30px">&emsp;&emsp;我的课程</h3>

        <table class="table table-striped table-hover text-center  "
               style="vertical-align: middle;text-align: center;">
            <thead>
            <tr>
                <th scope="col">序号</th>
                <th scope="col">封面图片</th>
                <th scope="col">课程名</th>
                <th scope="col">课程类</th>
                <th scope="col">创建时间</th>
                <th scope="col">审核状态</th>
                <th scope="col">操作</th>
            </tr>
            </thead>
            <tbody>
            {% for i in cource %}



                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td><img src="/static/media/{{ i.photo }}" height="60px" alt=""></td>
                    <td>{{ i.name }}</td>

                    <td>{% if i.type == 1 %}
                        工学

                    {% endif %} </td>
                    <td>
                        {{ i.myTime | date }}
                    </td>
                    {% if i.audit == 1 %}
                        <td style="color: #e3c00f">
                            审核中
                        </td>
                    {% elif i.audit == 2 %}
                        <td style="color: rgba(16,124,34,0.87)">
                            审核成功
                        </td>
                    {% elif i.audit == 3 %}
                        <td style="color: rgba(239,9,43,0.87)">
                            审核失败！
                        </td>
                    {% endif %}


                    <td>
                        <a href="{% url 'cource_edit' i.id %}"
                           class="btn btn-primary btn-sm">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                                 class="bi bi-pen" viewBox="0 0 16 16">
                                <path d="m13.498.795.149-.149a1.207 1.207 0 1 1 1.707 1.708l-.149.148a1.5 1.5 0 0 1-.059 2.059L4.854 14.854a.5.5 0 0 1-.233.131l-4 1a.5.5 0 0 1-.606-.606l1-4a.5.5 0 0 1 .131-.232l9.642-9.642a.5.5 0 0 0-.642.056L6.854 4.854a.5.5 0 1 1-.708-.708L9.44.854A1.5 1.5 0 0 1 11.5.796a1.5 1.5 0 0 1 1.998-.001zm-.644.766a.5.5 0 0 0-.707 0L1.95 11.756l-.764 3.057 3.057-.764L14.44 3.854a.5.5 0 0 0 0-.708l-1.585-1.585z"/>
                            </svg>
                            编辑</a>
                        <a href="{% url 'exercises' i.id %}"
                           class="btn btn-success  btn-sm">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                                 class="bi bi-clipboard-plus" viewBox="0 0 16 16">
                                <path fill-rule="evenodd"
                                      d="M8 7a.5.5 0 0 1 .5.5V9H10a.5.5 0 0 1 0 1H8.5v1.5a.5.5 0 0 1-1 0V10H6a.5.5 0 0 1 0-1h1.5V7.5A.5.5 0 0 1 8 7z"/>
                                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
                                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
                            </svg>
                            练习题</a>
                        <a onclick="if(confirm('确定删除吗？')==false)return false;location.href=('{% url 'cource_del' i.id %}')"
                           class="btn btn-danger  btn-sm">
                            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor"
                                 class="bi bi-x" viewBox="0 0 16 16">
                                <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
                            </svg>
                            删除
                        </a>

                    </td>
                </tr>
            {% empty %}
                <div class="text-center " style="height: 150px;">
                    <h4 style="margin-top: 50px;color: #1c51a1">请添加练课程！</h4>
                </div>
            {% endfor %}


            </tbody>
        </table>

        <hr>
        <a href="{% url 'cource_add' %}" type="button" class="btn btn-primary offset-11">添加新课程</a>

    </div>
{% endblock %}